package com.example.demo;

import java.util.HashMap;
import org.noear.nami.annotation.NamiClient;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.annotation.Param;

@Controller
public class DemoController {
  @NamiClient private DemoClient demoClient;

  @Mapping("/hello")
  public String hello(@Param(defaultValue = "world") String name) {
    return demoClient.hello("hello", name);
  }

  @Mapping("/hello2")
  public String hello2(@Param(defaultValue = "world") String name) {
    HashMap<String, String> map = new HashMap<>(2);
    map.put("name", name);
    map.put("welcome", "hello");
    return demoClient.hello2(map);
  }

  @Mapping("/hello3")
  public String hello3(@Param(defaultValue = "world") String name) {
    HashMap<String, String> map = new HashMap<>(2);
    map.put("name", name);
    return demoClient.hello3("hello", map);
  }
}
